package com.niit.controller

import com.niit.bean.AdClickData
import com.niit.handler.DataHandler
import com.niit.service.{AreaCountService, BlackListService, TimeCountService}
import org.apache.spark.streaming.dstream.DStream

/*
作用：用来接收外部数据
1. 启动Spark程序
2.启动Kafka
3.启动Flume
4.启动模拟数据脚本
 */
class AdDataController {

  private val blackListService = new BlackListService
  private val areaCountService = new AreaCountService
  private val timeCountService = new TimeCountService
    def dispatch(): Unit ={
    val data: DStream[AdClickData] = DataHandler.kafkaDataHandler("BD1", "newAD1")
      blackListService.dataAnalysis(data);
      areaCountService.dataAnalysis(data)
      timeCountService.dataAnalysis(data)
      DataHandler.startAndAwait()
  }

}
